package com.yuntuzhilian.chapter2.demo3;

import java.util.Scanner;

/**
 * @author MrWang-shuizhishuiheshui
 * @description
 */
public class MyShoping {
    Username un = new Username();
    Scanner input = new Scanner(System.in);

    /**
     * 登录菜单
     */
    public void showLoginMenu(){
        System.out.println("欢迎使用我行我素购" +
                "物管理系统");
        System.out.println("1.登录系统");
        System.out.println("2.退出");
        System.out.println("请选择,输入数字:");
        int num = input.nextInt();
        switch (num){
            case 1:
                int result = -1;
                do {
                    System.out.println("请输入用户名:");
                    String userName = input.next();
                    System.out.println("请输入密码:");
                    String passWord = input.next();
                    if (userName.equals(un.userName) && passWord.equals(un.passWord)){
                        System.out.println("@@登陆成功:"+userName+"@@");
                        result = 0;
                    }
                    else {
                        System.out.println("@@您没有权限进入系统请重新登录@@");
                        result = -1;
                    }
                }while (result == -1);
                //调用主页面方法,加载主页面
                showMainMenu();
                break;
            case 2:
                break;
        }
    }
    /**
     * 主菜单
     */
    public void showMainMenu(){
        System.out.println("我行我素购" +
                "物管理系统主菜单");
        System.out.println("1.客户管理系统");
        System.out.println("2.真情回馈");
        System.out.println("输入0返回上一级");
        System.out.println("请选择,输入数字:");
        int num = input.nextInt();
        switch (num){
            case 1:
                showCustMenu();
                break;
            case 2:
                showSendGMenu();
                break;
            case 0:
                showLoginMenu();
                break;
        }
    }
    /**
     * XXXXXXXX
     */
    public void showCustMenu(){
        System.out.println("我行我素购" +
                "物管理系统>客户信息管理菜单");
        System.out.println("输入0返回上一级");
        System.out.println("请选择,输入数字:");
        int num = input.nextInt();
        switch (num){
            case 0:
                showMainMenu();
                break;
        }
    }
    /**
     * 回馈
     */
    public void showSendGMenu(){
        System.out.println("我行我素购" +
                "物管理系统>真情回馈");
        System.out.println("1.幸运大放送");
        System.out.println("2.幸运抽奖");
        System.out.println("3.生日问候");
        System.out.println("输入0返回上一级");
        System.out.println("请选择,输入数字:");
        int num = input.nextInt();
        switch (num){
            case 0:
                showMainMenu();
                break;
            case 1:
                dfs();
        }
    }

    /*
    所谓的循环,迭代效应   迭代:循环的方式
     */

    public void dfs(){
        System.out.println("执行幸运大放送");
    }
}
